

# Here is an overview of the "core" automatic variables:
# $@ The name of the current target.
# $% The filename element of an archive member specification.
# $< The name of the first prerequisite.
# $? The names of all prerequisites that are newer than the target, separated by spaces.
# $^ The names of all the prerequisites, separated by spaces. This list has duplicate names removed
#   since for most uses, such as compiling, copying, etc., duplicates are not wanted.
# $+ Similar to $^, this is the names of all the prerequisites separated by spaces, except that $+ includes
#   duplicates. This variable was created for specific situations such as arguments to linkers where
#  duplicate values have meaning.
# $* The stem of the target filename. A stem is typically a filename without its suffix. How stems are
#   computed is covered in section 3.8. Its use outside of pattern rules is discouraged.

cfl = -ggdb -Wall -L/home/jose/programming/programlibraries/cmlib/Linux-x86_64-3.2.0/lib
execs = testprog

executables : $(execs)

testprog : testprog.o  
	gfortran $^ hertzian_class.o lubricant_class.o solidmat_class.o ellipticintegrals_module.o   -o $@  $(cfl)

testprog.o : testprog.f03 lubricant_class.mod hertzian_class.mod
	gfortran -c $<  $(cfl)

lubricant_class.o : lubricant_class.f03
	gfortran -c $<  $(cfl)

lubricant_class.mod : lubricant_class.f03  lubricant_class.o
	@true

hertzian_class.o : hertzian_class.f03 solidmat_class.mod ellipticintegrals_module.mod
	gfortran -c $< -lcm  $(cfl)

hertzian_class.mod : hertzian_class.f03  hertzian_class.o
	@true

solidmat_class.o : solidmat_class.f03
	gfortran -c $<  $(cfl)

solidmat_class.mod : solidmat_class.f03  solidmat_class.o
	@true

ellipticintegrals_module.o : ellipticintegrals_module.f03 
	gfortran -c $<  $(cfl)

ellipticintegrals_module.mod : ellipticintegrals_module.f03  ellipticintegrals_module.o slatec90/libslatec.a
	@true





# Maintenance

clean :
	rm -f *.o *.mod $(execs)

